import axios from 'axios'
import envFuncs from '@/config/base'
let env = envFuncs.getParams()

export default {
  // 设置客户分配的顾问和分配比例
  openRedpack ({state, rootState}, info) {
    const CRM_API_HOST = env.CRM_API_HOST
    // const CRM_API_HOST = 'http://120.25.62.186:8900/http://120.24.223.186:8800/mockjsdata/1'
    return axios.post(
      CRM_API_HOST + '/users/' + rootState.app.token + '/redpacket/' + info.red_creater_id
    )
  },
  getRedpackFlow ({state, rootState}) {
    const CRM_API_HOST = env.CRM_API_HOST
    // const CRM_API_HOST = 'http://120.25.62.186:8900/http://120.24.223.186:8800/mockjsdata/1'
    return axios.get(
      CRM_API_HOST + '/users/' + rootState.app.token + '/redpacket_flow'
    )
  },
  getRedpackBalance ({state, rootState}) {
    const CRM_API_HOST = env.CRM_API_HOST
    // const CRM_API_HOST = 'http://120.25.62.186:8900/http://120.24.223.186:8800/mockjsdata/1'
    return axios.get(
      CRM_API_HOST + '/users/' + rootState.app.token + '/redpacket_balance'
    )
  },
  tixian ({state, rootState}, info) {
    const CRM_API_HOST = env.CRM_API_HOST
    // const CRM_API_HOST = 'http://120.25.62.186:8900/http://120.24.223.186:8800/mockjsdata/1'
    return axios.post(
      CRM_API_HOST + '/users/' + rootState.app.token + '/redpacket/tixian/' + info.tixian_money
    )
  }
}
